﻿@page "/history"
@inherits DiariesPageComponentBase

<link href="css/extend/masa-blazor-extend-enqueued-snackbars.css" rel="stylesheet" />

<MAppBar App="true"
         Elevation="0">
    @if (NormalCalendarVisible)
    {
        <MToolbarTitle Class="font-weight-bold">
            @(I18n.T("History.Calendar"))
        </MToolbarTitle>
    }
    else
    {
        <MTextField Value="PickedDate"
                    Class="rounded-lg text-h6 font-weight-bold"
                    Dense="true"
                    Readonly="true"
                    Solo="true"
                    Flat="true"
                    HideDetails="@("auto")"
                    PrependIcon="mdi-calendar">
        </MTextField>
        <MSpacer></MSpacer>
        <MButton Icon="true"
                 Large="true"
                 OnClick="()=>ShowFloatCalendar=true">
            <MIcon>mdi-pencil-outline</MIcon>
        </MButton>
    }
</MAppBar>

<ScrollContainer @ref="scrollContainer">
    <div class="normal-calendar">
        <MDatePicker @bind-Value="PickedDate"
                     Class="rounded-lg my-picker mb-5 pt-4"
                     TValue="DateOnly"
                     ShowCurrent="false"
                     FullWidth="true"
                     NoTitle="true"
                     Color="primary"
                     Events="EventsDates"
                     EventColor='"primary"'
                     Locale="@(I18n.Culture.Name)">
        </MDatePicker>
    </div>

    <DiaryCardList @bind-Tags="Tags"
                   Value="Diaries"
                   OnUpdate="UpdateEventsDates">
    </DiaryCardList>
</ScrollContainer>

<MyDatePicker @bind-Value="ShowFloatCalendar"
@bind-Date="PickedDate"
              Events="EventsDates"
              EventColor='"primary"'>
</MyDatePicker>